<?php
session_start();
include '../phpFunctions/databaseConnect.php';
$titel=$_POST['titel'];
$beskrivning=$_POST['beskrivning'];
$pris=$_POST['pris'];
$hojd=$_POST['hojd'];
$bredd=$_POST['bredd'];
$itemID =$_POST['itemID'];
$radera =$_POST['radera'];

$query = "UPDATE items
          SET title = '$titel', description = '$beskrivning', price = '$pris', height = '$hojd', width = '$bredd'
          where item_id = '$itemID'";
mysql_query($query);

if ($radera=='on'){
    $query = "DELETE from items where item_id = $itemID";
//    mysql_query($query);
//    $filename = "../Images/profilePictures/$picurl";
    unlink($filename);

    header('Location: ../index.php ');

}
else {
//    alert('Din annons är ändrad') or die (print 'död');
    header("Location: ../Bildgalleri/showItem.php?itemID=$itemID");
    print 'ändrad';
}

//radera grejjen
mysql_close();
?>
